package com.demo.youxuanmall.controller.admin;

import com.demo.youxuanmall.common.Result;
import com.demo.youxuanmall.entity.Category;
import com.demo.youxuanmall.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("productCategoryApiController")
@RequestMapping("/api")
public class AdminCategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("/categories")
    public Result<List<Category>> list() {
        List<Category> categories = categoryService.list();
        return Result.success(categories);
    }
} 